package com.qys.livesMall.shortVideo.controller.sys;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qys.livesMall.common.result.R;
import com.qys.livesMall.shortVideo.model.dto.sys.SysShortVideoCommentsHideDTO;
import com.qys.livesMall.shortVideo.model.dto.sys.SysShortVideoCommentsPageDTO;
import com.qys.livesMall.shortVideo.model.vo.sys.SysShortVideoCommentsVO;
import com.qys.livesMall.shortVideo.service.IH2ShortVideoCommentsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 短视频评论 前端控制器
 * </p>
 *
 * @author dp
 * @since 2023-05-04
 */
@RestController
@RequestMapping("/sys/short/video/comments")
@Tag(name = "后台管理-短视频评论信息")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class H2ShortVideoCommentsController {

    private final IH2ShortVideoCommentsService shortVideoCommentsService;

    @PostMapping("/page")
    @Operation(summary = "分页查询短视频评论信息")
    public R<Page<SysShortVideoCommentsVO>> pageBySystem(@RequestBody SysShortVideoCommentsPageDTO queryDTO) {
        return R.ok(shortVideoCommentsService.pageBySystem(queryDTO));
    }

    @PostMapping({"/hide", "/show"})
    @Operation(summary = "隐藏/显示评论信息")
    public R<Page<SysShortVideoCommentsVO>> hideOrShowComments(@RequestBody SysShortVideoCommentsHideDTO commentsHideDTO) {
        shortVideoCommentsService.hideOrShowComments(commentsHideDTO);
        return R.ok();
    }

    @DeleteMapping({"/remove"})
    @Operation(summary = "删除评论信息")
    public R<Page<SysShortVideoCommentsVO>> removeComments(@RequestBody SysShortVideoCommentsHideDTO commentsHideDTO) {
        shortVideoCommentsService.removeByIds(commentsHideDTO.getIds());
        return R.ok();
    }
}
